home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / MosaicSRC / libwww2 / HTAccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  3.9 KB  |  165 lines

  1. /*          HTAccess:  Access manager  for libwww
  2.                                       ACCESS MANAGER
  3.                                              
  4.    This module keeps a list of valid protocol (naming scheme)
  5.    specifiers with associated access code.  It allows documents to be
  6.    loaded given various combinations of parameters. New access
  7.    protocols may be registered at any time.
  8.    
  9.    Part of the libwww library .
  10.    
  11.  */
  12. #ifndef HTACCESS_H
  13. #define HTACCESS_H
  14.  
  15. /*      Definition uses:
  16. */
  17. #include "HTUtils.h"
  18. #include "tcp.h"
  19. #include "HTAnchor.h"
  20. #include "HTFormat.h"
  21.  
  22. #ifdef SHORT_NAMES
  23. #define HTClientHost            HTClHost
  24. #define HTOutputStream          HTOuStre
  25. #define HTOutputFormat          HTOuForm
  26. #endif
  27.  
  28. /*      Return codes from load routines:
  29. **
  30. **      These codes may be returned by the protocol modules,
  31. **      and by the HTLoad routines.
  32. **      In general, positive codes are OK and negative ones are bad.
  33. */
  34.  
  35. #define HT_NO_DATA -9999        /* return code: OK but no data was loaded */
  36.                                 /* Typically, other app started or forked */
  37.  
  38.  
  39. /*
  40.  
  41. Flags which may be set to control this module
  42.  
  43.  */
  44. extern int HTDiag;                      /* Flag: load source as plain text */
  45. extern char * HTClientHost;             /* Name or number of telnetting host */
  46. extern FILE * logfile;                  /* File to output one-liners to */
  47. extern HTStream* HTOutputStream;        /* For non-interactive, set this */
  48. extern HTFormat HTOutputFormat;         /* To convert on load, set this */
  49.  
  50.  
  51.  
  52. /*
  53.  
  54. Load a document from relative name
  55.  
  56.   ON ENTRY,
  57.   
  58.   relative_name           The relative address of the file to be accessed.
  59.                          
  60.   here                    The anchor of the object being searched
  61.                          
  62.   ON EXIT,
  63.   
  64.   returns    YES          Success in opening file
  65.                          
  66.   NO                      Failure
  67.                          
  68.  */
  69. extern  BOOL HTLoadRelative PARAMS((
  70.                 CONST char *            relative_name,
  71.                 HTParentAnchor *        here));
  72.  
  73.  
  74. /*
  75.  
  76. Load a document from absolute name
  77.  
  78.   ON ENTRY,
  79.   
  80.   addr                    The absolute address of the document to be accessed.
  81.                          
  82.   filter                  if YES, treat document as HTML
  83.                          
  84.  */
  85.  
  86. /*
  87.  
  88.   ON EXIT,
  89.   
  90.  */
  91.  
  92. /*
  93.  
  94.   returns YES             Success in opening document
  95.                          
  96.   NO                      Failure
  97.                          
  98.  */
  99. extern int HTLoadAbsolute PARAMS((CONST char * addr));
  100.  
  101.  
  102. /*
  103.  
  104. Load a document from absolute name to a stream
  105.  
  106.   ON ENTRY,
  107.   
  108.   addr                    The absolute address of the document to be accessed.
  109.                          
  110.   filter                  if YES, treat document as HTML
  111.                          
  112.   ON EXIT,
  113.   
  114.   returns YES             Success in opening document
  115.                          
  116.   NO                      Failure
  117.                          
  118.    Note: This is equivalent to HTLoadDocument
  119.    
  120.  */
  121. extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
  122.                                 HTStream * sink));
  123.  
  124.  
  125. /*
  126.  
  127. Make a stream for Saving object back
  128.  
  129.   ON ENTRY,
  130.   
  131.   anchor                  is valid anchor which has previously beeing loaded
  132.                          
  133.   ON EXIT,
  134.   
  135.   returns                 0 if error else a stream to save the object to.
  136.                          
  137.  */
  138.  
  139.  
  140. extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
  141.  
  142.  
  143. /*
  144.  
  145. Register an access method
  146.  
  147.  */
  148.  
  149. typedef struct _HTProtocol {
  150.         char * name;
  151.         
  152.         int (*load)PARAMS((
  153.                 CONST char *    full_address,
  154.                 HTParentAnchor * anchor,
  155.                 HTFormat        format_out,
  156.                 HTStream*       sink));
  157.                 
  158.         HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
  159.  
  160. } HTProtocol;
  161.  
  162. extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
  163.  
  164. #endif /* HTACCESS_H */
  165.